Release 10.1A: OpenEdge Getting Started:
Object-oriented Programming


Deleting an object

When you delete an object using the DELETE OBJECT statement, the destructors, if any, for every class in the hierarchy are automatically run. The destructors are run from the bottom of the class hierarchy to the top.

Refer once again to this sample class hierarchy:

Progress.Lang.Object                   <--- Top of hierarchy 
    acme.myObjs.Common.CommonObj 
        acme.myObjs.CustObj 
            acme.myObjs.NECustomer    <--- Bottom of hierarchy 

The DELETE OBJECT statement for an instance of acme.myObjs.NECustomer invokes the acme.myObjs.NECustomer destructor, if it has one, followed by the acme.myObjs.CustObj destructor, followed by the acme.myObjs.Common.CommonObj destructor and finally the implicit destructor for the built-in root class, Progress.Lang.Object. Progress executes all the destructors automatically. You do not use the SUPER statement in a destructor. Remember that a destructor is always public and it can have no parameters.

Unlike constructors, the destructors in the class hierarchy execute to completion from bottom to top. When an object is instantiated, code in its constructors must execute from the top down to initialize super class resources that might be referenced by a subclass. By contrast, the destructors have the opportunity to free resources created by a subclass before it terminates and passes control to its super class for further clean-up, which has no knowledge of or need to reference its subclass.


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095